<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>JS中的switch和while和for</title>
</head>
<body>

<script>
    // switch: 判断是星期几

    // while
    /*let sum = 0;
    let i = 1;
    while (i <= 100) {
        sum += i;
        i++;
    }
    alert(sum);*/

    // 创建数组
    let arr = new Array(11, 22, 33, 44);

    // 普通for循环
    for (let i = 0; i < arr.length; i++) {
        document.write(arr[i]+"<br/>");
    }
    document.write("-----------------------" + "<br/>");

    // 增强for循环: for...of
    for(let num of arr){
        document.write(num+"<br/>");
    }
</script>

</body>
</html>